home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_sparkles.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  82 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_sparkles.cog
  4. #
  5. # Sparkle animates periodically
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. symbols
  13. message     startup
  14. message     timer
  15. message        sighted
  16. message        entered
  17. message        removed
  18.  
  19. surface        trigger1    linkid=2
  20. surface        trigger2    linkid=2
  21.  
  22. sector        noflash1    nolink
  23. sector        noflash2    nolink
  24.  
  25. thing        gem
  26. thing        sparkle        nolink
  27.  
  28. material    animmat=pyr_a4_eye_gem_sparkle.mat    local
  29. end
  30.  
  31. code
  32. startup:
  33.     #start sprite animating and hide it
  34.     MaterialAnim(animmat, 20, 1);
  35.     AnimateSpriteSize(sparkle, '0.2 0.2 1.0', '0.01 0.01 0.5', .01);
  36.     return;
  37.  
  38. entered:
  39. # ---> trigger faces    
  40.     
  41.     if ((GetSenderRef() != trigger1) && (GetSenderRef() != trigger2)) return;
  42.     
  43.     # if gem is gone, exit
  44.     if (gem == -1) return;
  45.  
  46.     # trigger faces will force sightings
  47.     ClearThingFlags(gem, 0x100000);
  48.     return;
  49.     
  50. sighted:
  51. # ---> gem    
  52.     
  53.     #prepare for next sighting
  54.     SetTimer(RandBetween(10, 20));
  55.  
  56.     #if player is too close to it, don't flash
  57.     if (GetThingSector(GetLocalPlayerThing()) == noflash1) return;
  58.     if (GetThingSector(GetLocalPlayerThing()) == noflash2) return;
  59.     
  60.     #animate sprite up and down
  61.     AnimateSpriteSize(sparkle, '0.01 0.01 0.0', '0.2 0.2 1.0', .25);
  62.     sleep(.35);
  63.     AnimateSpriteSize(sparkle, '0.2 0.2 1.0', '0.01 0.01 0.0', .25);
  64.  
  65.     return;
  66.  
  67. timer:
  68.     # set thing to unseen
  69.     ClearThingFlags(gem, 0x100000);
  70.     return;
  71.  
  72. removed:
  73. # ---> gem (or watch)
  74.  
  75.     # if hornerwatch cog destroys the gem, get rid of the sparkle
  76.     DestroyThing(sparkle);
  77.     gem = -1;
  78.     SetTimer(0);
  79.     return;
  80.  
  81. end
  82.